package com.sm.scorpio.ui.activity;

import android.os.Bundle;

import com.sm.imlibrary.imsdk.SIMManager;
import com.sm.scorpio.R;
import com.sm.scorpio.ui.base.BaseActivity;
import com.sm.scorpio.ui.base.BaseFragment;
import com.sm.scorpio.ui.fragment.home.HomeFragment;
import com.sm.scorpio.ui.fragment.message.MessageFragment;
import com.sm.scorpio.ui.fragment.mine.MineFragment;
import com.sm.scorpio.ui.fragment.water.WaterFragment;
import com.sm.scorpio.ui.view.SMBottomNavigationView;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends BaseActivity implements SMBottomNavigationView.OnNavigationItemSelectedListener {
    private SMBottomNavigationView bottomNavigationView;
    private List<BaseFragment> fragments;

    @Override
    protected int onCreateLayout() {
        return R.layout.activity_main;
    }

    @Override
    protected void onInit(Bundle savedInstanceState) {
        hideToolbarView();
        bottomNavigationView = v.getView(R.id.navigation);
        bottomNavigationView.setOnNavigationItemSelectedListener(this);
        fragments = Arrays.asList(new HomeFragment(), new WaterFragment(), null, new MessageFragment(), new MineFragment());
        bottomNavigationView.setLinkageFragments(fragments, getSupportFragmentManager());
        bottomNavigationView.setSelectedItem(0);
    }


    @Override
    public void onNavigationItemStartSelected(int current_id, int target_id) {

    }

    @Override
    public void onNavigationItemEndSelected(int target_id) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SIMManager.getInstance().stop();
    }
}
